/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.home.logic;

import com.home.dao.SchemeDao;
import com.home.mapping.Scheme;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 *
 * @author pnduy
 */
public class SchemeLogic {
    public Scheme findSchemeAndScalesById(Integer id) {
        return (Scheme) new SchemeDao().findSchemeById(id);
    }
    
    public List<Scheme> findAllScheme() {
        return new SchemeDao().findAllScheme();
    }
    
    public Map<Integer,Scheme> findAllSchemeMap() {
        Map<Integer,Scheme> map = new HashMap<Integer,Scheme>();
        List<Scheme> list = findAllScheme();
        for (Scheme scheme : list) {
            map.put(scheme.getIdScheme(), scheme);
        }
        return map;
    }
}
